<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>保单查询</title>
<link href="../style/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="../style/style.css" />


<script src="<%=basePath%>/Scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script src="<%=basePath%>/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<script src="<%=basePath%>/Scripts/ui.datepicker-zh_CN.js" type="text/javascript"></script>
<link href="<%=basePath%>/style/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />




<script>


function datePicker(pickerName,locale) {
		$(pickerName).datepicker($.datepicker.regional[locale]);
		$(pickerName).datepicker('option', 'changeMonth', true);//月份可调
		$(pickerName).datepicker('option', 'changeYear', true);//年份可调
		
	}
$(document).ready(function(){
datePicker('#insuranceDateStart','zh_CN');
datePicker('#insuranceDateEnd','zh_CN');
datePicker('#insuranceStartDateStart','zh_CN');
datePicker('#insuranceStartDateEnd','zh_CN');
});



 function changeV(objID)
{
	if(document.getElementById("tbody_"+objID).style.display == "block")
	{
		
		document.getElementById("img_"+objID).src = "../images/ico_have2.gif";
		document.getElementById("tbody_"+objID).style.display = "none"
	}
	else
	{
		document.getElementById("img_"+objID).src = "../images/ico_nohave2.gif";
		document.getElementById("tbody_"+objID).style.display = "block"
	}
}
function changeCompany(){
	var companyList =  document.getElementById("company");
	var companyNum = companyList.options[companyList.selectedIndex].value;
	alert(companyNum);
	if(companyNum == "")
		return;
	$.post("/WITAgent/Product/findSubcompanyByCompanyAction.action",{companyNum:companyNum},function(data){
		var subcompanyList = document.getElementById("subcompany");
		while(subcompanyList.options.length > 0){
			subcompanyList.remove(0);
		}
		var op = document.createElement("option");
            op.value = "";
            op.text = "--全部--";
            subcompanyList.options.add(op);
		for(var i=0;i<data.length;i++){
            op = document.createElement("option");
            op.value = data[i].insuranceNumber;
            op.text = data[i].insuranceName;
            subcompanyList.options.add(op);
        }
	},"json");
}
function editPolicy(){
	var comps_del = document.getElementsByName("policys");
	var count = 0;
	var index = 0; 
	for(var i = 0; i < comps_del.length; i ++){
		if(comps_del[i].checked){
			count ++;
			index = i;
		}
	}
	alert(comps_del[index].value);
	if(count == 1){
		window.location.href = "policyAction!findPolicy.action?policy.policyId="+comps_del[index].value;
	}
	else{
		window.alert("请选择一个编辑选项");
	}
	return false;
}
	function DaoRu()
	{
	  alert("导入"); 
	}
	function DaoChu()
	{
	   alert("导出");
	  var par=new Array();
	   $('input[name="policys"]').each(function(){    
         par.push($(this).val());
        });  
        alert(par);
        window.location.href("DaoChuAction?paramlist="+par);
        window.location.href = "DaoChuAction?paramlist="+par;
	}
</script>
    


</head>
<body>
<table width="1100" align="left" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td>
      <table width="100%"  cellpadding="0" cellspacing="0" class="table2">
        <tr>
          <td valign="top">
            <table width="100%" class="top" cellpadding="0" cellspacing="0">
              <tr>
                <td>当前位置:&nbsp;保单管理&nbsp;&gt;&gt;&nbsp;保单查询</td>
              </tr>
            </table>
			<div id="mainareacontent">
        <div class="mainarea">
        
        <s:form action="policyAction!inquirePolicy" method="post" method="simple" id="inquire" theme="simple">
            <div class="search">			
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="ico">
                            <a href="javascript:changeV(1)">
                                <img src="../images/ico_have2.gif" id="img_1" border="0"/></a>                        </td>
                      <td align="left" ><table cellpadding="0" cellspacing="0" border="0" width="100%"  style=" display:block">
                        <tr>
                          <td width="76"> 保单编号： </td>
                          <td width="229" align="left"><s:textfield name="policy.policyId"/>                          </td>
                          <td width="83" align="right"> 客户编号： </td>
                          <td width="189"><s:textfield name="clientNumber"/></td>
                          <td width="73" align="right"> 客户名称： </td>
                          <td width="225"><s:textfield name="clientName"/></td>
                          <td width="189" align="left" ><img src="../images/btn_search.gif" onclick="document.getElementById('inquire').submit();"/>&nbsp;<img src="../images/btn_reset.gif" width="50" height="20" onclick="document.getElementById('inquire').reset();"/> </td>
                        </tr>                        
                      </table><table width="100%" border="0"   cellpadding="0" cellspacing="0" id="tbody_1"  style=" display:none">
                          <tr>
                            <td width="76">投保日期： </td>
                            <td width="229"><s:textfield name="insuranceDateStart" id="insuranceDateStart" cssClass="txt_calendar" cssStyle="width: 60px"><s:param name="value"><s:date name="insuranceDateStart" format="yyyy-MM-dd"/></s:param></s:textfield>
                            至<s:textfield name="insuranceDateEnd" id="insuranceDateEnd" cssClass="txt_calendar" cssStyle="width: 60px"><s:param name="value"><s:date name="insuranceDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield></td>
                            <td width="83" height="19" align="right">保险公司：</td>
                            <td width="189"><s:select list="companyList" headerKey="''" headerValue="--全部--" listKey="companyNum" listValue="companynameC" onchange="changeCompany()" id="company">
                            </s:select><br/></td>
                            <td width="73" align="right">分支机构：</td>
                            <td width="225"><s:select id="subcompany" name="subcompanyId" list="#{}"/>
                            </td>
                            <td width="189">&nbsp;</td>
                          </tr>
                          <tr>
                            <td>启保日期： </td>
                            <td><s:textfield name="insuranceStartDateStart" id="insuranceStartDateStart" cssStyle="width: 60px"><s:param name="value"><s:date name="insuranceStartDateStart" format="yyyy-MM-dd"/></s:param></s:textfield>
                              至<s:textfield name="insuranceStartDateEnd" id="insuranceStartDateEnd" cssStyle="width: 60px"><s:param name="value"><s:date name="insuranceStartDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
                             </td>
                            <td align="right">&nbsp;<br /></td>
                            <td>&nbsp;</td>
                            <td align="right">&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                      </table></td>
                    </tr>
                </table>
            </div>

             <table width="100%" cellpadding="0" cellspacing="0"class="table3">
                 <tr>
                     <td width="6%" class="title">&nbsp;</td>
                     <td width="5%" ><span class="clientinfo_but" ><a href="policy_new.jsp">新&nbsp;增</a></span></td>
                   <td width="5%" ><span class="clientinfo_but"><a href="right_Policy_edit.jsp#" onclick="return editPolicy()">修&nbsp;改</a></span></td>
                     <td width="5%" >&nbsp;</td>
                     <td width="18%" >&nbsp;</td>
                     <td width="5%" ><span class="clientinfo_but" onclick="DaoRu()">导&nbsp;入</span></td>
                     <td width="5%" ><span class="clientinfo_but" onclick="DaoChu()">导&nbsp;出</span></td>
                     <td width="5%" ><span class="clientinfo_but">打&nbsp;印</span></td>  
                     <td width="14%" >&nbsp;</td>
                 </tr>
             </table>

            <table width="100%" cellpadding="0" cellspacing="1" class="dg_borderstyle">
              <thead>
                <tr>
                  <th width="32" height="52">&nbsp;</th>
                  <th width="69">保单编号</th>
                  <th width="96">客户编号</th>
                  <th width="131">客户名称</th>
                  <th width="72">保险公司</th>
                  <th width="68">保险险种</th>
                  <th width="61">保额</th>
                  <th width="76">保费（原） </th>
                  <th width="72">投保日期</th>
                </tr>
              </thead>
              <tbody>
              <s:iterator value="policyList">
                <tr align="center">
                  <td><input type="radio" name="policys" value="<s:property value='policyId'/>" /></td>
                  <td><a href="policyAction!scanPolicy.action?policy.policyId=<s:property value='policyId'/>"><s:property value="policyId"/></a></td>
                  <td><s:property value="client.clientId"/></td>
                  <td><s:property value="client.clientName"/></td>
                  <td><s:property value="insurancedef.subcompany.companynameC"/></td>
                  <td><s:property value="insurancedef.insurancetype.insuranceName"/></td>
                  <td><s:property value="sumFee"/></td>
                  <td><s:property value="sumFee+otherFee"/></td>
                  <td><s:date name="insuranceDate" format="yyyy-MM-dd"/></td>
                </tr>
                </s:iterator>
              </tbody>
            </table>

             <table width="100%" cellpadding="0" cellspacing="0" class="dg_pagestyle">
                <tr>
                    <td class="pageinfo">
                         共<s:property value="pager.pageCount"/>页/<s:property value="pager.recordCount"/>条记录                    </td>
                    <td class="pagebutton">
                        每页
                        <s:select list="#{'1':'1','20':'20','50':'50'}" name="pager.pageSize">
                        </s:select>
                        条记录 | 第<s:textfield name="pager.pageCurrent" cssStyle="width: 20px;" id="pagecurrent"/>页<img src="../images/btn_go.gif" onclick="document.getElementById('inquire').submit();"/>
                        <img src="../images/btn_sy.gif" onclick="goToPage(1)"/>
                         <s:if test="pager.pageCurrent > 1">
                        <img src="../images/btn_syy.gif" onclick="goToPage(<s:property value='pager.pageCurrent - 1'/>)"/>
                        </s:if>
                        <s:if test="pager.pageCurrent < pager.pageCount">
                        <img src="../images/btn_xyy.gif" onclick="goToPage(<s:property value='pager.pageCurrent + 1'/>)"/>
                        </s:if>
                        <img src="../images/btn_wy.gif" onclick="goToPage(<s:property value='pager.pageCount'/>)"/></td>
                </tr>
            </table>
        </s:form>
            
        </div>
      </div></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<script type="text/javascript">
function goToPage(page){
	document.getElementById("pagecurrent").value = page;
	document.getElementById("inquire").submit();
}
</script>
 </body>
</html>
